Component({
  properties: {
    label: {
      type: String,
      value: '任务优先级'
    },
    priorities: {
      type: Array,
      value: [
        { id: 1, name: '紧急', class: 'high' },
        { id: 2, name: '高', class: 'high' },
        { id: 3, name: '中', class: 'medium' },
        { id: 4, name: '低', class: 'low' }
      ]
    },
    selectedPriority: {
      type: Number,
      value: 3
    }
  },

  methods: {
    onSelectPriority(e) {
      const priorityId = e.currentTarget.dataset.id
      this.setData({
        selectedPriority: priorityId
      })
      
      // 触发自定义事件
      this.triggerEvent('prioritychange', { priorityId })
    }
  }
})